
export const data = [
    {
        name: 'Sheet1',
        freeze: 'A3',
        styles: [
            { bgcolor: '#fed964' },
            { bgcolor: '#fff2cd' },
            { bgcolor: '#bdd7ee' },
            { bgcolor: '#ffffff' },
            { format: 'number' },
            { format: 'number', bgcolor: '#fff2cd' },
        ],
        merges: ['A1:A2', 'B1:B2', 'C1:D1', 'G1:I1', 'E1:F1'],
        rows: {
            0: {
                cells: {
                    0: { text: '项     目', merge: [1, 0], style: 2 },
                    1: { text: '单\n位', merge: [1, 0], style: 2 },
                    2: { text: '期初在产品', merge: [0, 1], style: 2 },
                    3: { style: 2 },
                    4: { text: '本期发生额', style: 2, merge: [0, 1] },
                    6: { text: '合计', merge: [0, 2], style: 2 },
                    7: { style: 2 },
                    8: { style: 2 },
                },
            },
            1: {
                cells: {
                    0: { style: 2 },
                    1: { style: 2 },
                    2: { text: '数量', style: 2 },
                    3: { text: '金额', style: 2 },
                    4: { text: '数量', style: 2 },
                    5: { text: '金额', style: 2 },
                    6: { text: '数量', style: 2 },
                    7: { text: ' 单价 ', style: 2 },
                    8: { text: '金额', style: 2 },
                },
            },
            2: {
                cells: {
                    0: { text: '<#subject#>$.name' },
                    1: { text: '<#subject#>$.dw' },
                    2: { text: '<#subject#>$.count1', style: 4 },
                    3: { text: '<#subject#>$.count1*6', style: 4 },
                    4: { text: '<#subject#>$.count2', style: 4 },
                    5: { text: '<#subject#>$.count2*2', style: 4 },
                    6: { text: '<#subject#>$.count', style: 4 },
                    7: { text: '<#subject#>$.price', style: 4 },
                    8: { text: '<#subject#>$.count*$.price', style: 4 },
                },
            },
            4: {
                cells: {
                    0: { text: '合计', style: 1 },
                    1: { style: 1 },
                    2: { text: '=SUM(C3:C4)', style: 5 },
                    3: { text: '=SUM(D3:D4)', style: 5 },
                    4: { text: '=SUM(E3:E4)', style: 5 },
                    5: { text: '=SUM(F3:F4)', style: 5 },
                    6: { text: '=SUM(G3:G4)', style: 5 },
                    7: { text: '=SUM(H3:H4)', style: 5 },
                    8: { text: '=SUM(I3:I4)', style: 5 },
                },
            },
            5: {
                cells: {
                    0: { text: '日期', style: 2 },
                    1: { text: '$.date' },
                    2: { text: '填表人', style: 2 },
                    3: { text: '$.name1' },
                    4: { text: '负责人', style: 2 },
                    5: { text: '$.name2' },
                },
            },
            len: 12,
        },
        cols: {
            0: { width: 170 },
            1: { width: 136 },
            2: { width: 170 },
            3: { width: 170 },
            4: { width: 170 },
            5: { width: 170 },
            6: { width: 170 },
            7: { width: 170 },
            8: { width: 224 },
            len: 20,
        },
        validations: [],
        autofilter: {},
    },
]
export const data2 = [
    {
        name: 'Sheet1',
        styles: [
            { bgcolor: '#fed964' },
            { bgcolor: '#fff2cd' },
            { bgcolor: '#bdd7ee' },
            { bgcolor: '#ffffff' },
            { format: 'number' },
            { format: 'number', bgcolor: '#fff2cd' },
        ],
        merges: [],
        rows: {
            len: 12,
        },
        cols: {
            0: { width: 170 },
            1: { width: 136 },
            2: { width: 170 },
            3: { width: 170 },
            4: { width: 170 },
            5: { width: 170 },
            6: { width: 170 },
            7: { width: 170 },
            8: { width: 224 },
            len: 20,
        },
        validations: [],
        autofilter: {},
    },
]

let curDate = new Date();

function mockMoney() {
    return Math.ceil(Math.random() * 100000) / 100
}

export function mockBindData() {
    let subjectName = '钨粉投入,代加工投入,碳化钨投入,代加工钨粉投入,代加工碳化钨投入,次品料碳化钨投入'.split(',')
    let subject = []
    let index = 0
    let len = subjectName.length
    let count = Math.ceil(Math.random() * 8 + 10)

    for(let i = 0; i < count; i++) {
        subject.push({
            name: subjectName[index] + (i + 1),
            dw: '吨',
            count1: mockMoney(),
            count2: mockMoney(),
            count3: mockMoney(),
            count: mockMoney(), price: mockMoney()
        })
        index = index >= len - 1 ? 0 : (index + 1)
    }

    return {
        date: `${curDate.getFullYear()}年${curDate.getMonth() + 1}月${curDate.getDate()}日`,
        vendor: '炬联众慧',
        code: 'A0001',
        count1: 21,
        money1: 12,
        name: '张三',
        name1: '张三',
        name2: '李四',
        subject
    }
}
